import request from "../../common/request";
// 获取维保任务
export function mainList(data) {
  console.log(data, "传递的参数");
  return request.request({
    url: `/treatment-plant/getMaintain`,
    method: "post",
    data: data,
  });
}
//获取巡检工单 /treatment-inspect/getInspectOrder
export function insList(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/treatment-inspect/getInspectOrder`,
      method: "post",
      data: data,
    });
  }
//报停通知
export function stopNotice(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/treatment-plant/stop-notice`,
      method: "post",
      data: data,
    });
  }
  //报停详情
  export function stopNoticeDetail(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/treatment-plant/stop-getDetails?id=${data}`,
      method: "post",
      data: data,
    });
  }
  //报修通知
export function repairNotice(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-plant/repair-notice`,
      method: "post",
      data: data,
    });
  }
  //报备通知/treatment-plant/fail-notice
  export function plantNotice(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-plant/fail-notice`,
      method: "post",
      data: data,
    });
  }
  //报修详情
  export function repairNoticeDetail(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/treatment-plant/repair-getDetails?id=${data}`,
      method: "post",
      data: data,
    });
  }
  //生产报备 http://127.0.0.1:20001/knowledge-base/productionFail
  export function addBase(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/productionFail`,
      method: "post",
      data: data,
    });
  }
   //报备详情
   export function plantNoticeDetail(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/treatment-plant/fail-getDetails?id=${data}`,
      method: "post",
      data: data,
    });
  }
  //设备列表 /device/list
  export function deviceList(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/device/list`,
      method: "get",
      data: data,
    });
  }
  //维保-设备报停 /treatment-plant/treatment-stop
  export function addStop(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-plant/treatment-stop`,
      method: "post",
      data: data,
    });
  }
  //维保-派发维保 /treatment-plant/distributeMaintain
  export function addDisMain(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-plant/distributeMaintain`,
      method: "post",
      data: data,
    });
  }
  //巡检-设备保修 /treatment-inspect/device-repair
  export function addRepair(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-inspect/device-repair`,
      method: "post",
      data: data,
    });
  }
  //平台常用量管理
  export function typeList(data) {
    return request.request({
      url: '/constant/getAllConstant',
      method: 'post',
      data,
    })
  }
  // 展示具体常量值
  export function detail(data) {
    return request.request({
      url: `/constant/getSpecificConstant?id=${data.id}`,
      method: 'post',
      // data,
    })
  }
  //用户列表
  export function getUser(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/repair-maintain-task/RepairOperator`,
      method: "post",
      data: data,
    });
  }
  //巡检-巡检对象
  export function inspect(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-inspect/list`,
      method: "get",
      data: data,
    });
  }
  //发布巡检工单 /treatment-inspect/distribute-inspect
  export function Addinspect(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-inspect/distribute-inspect`,
      method: "post",
      data: data,
    });
  }
  //部门列表
  export function deptList(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/dept/listOutPage`,
      method: "get",
      data: data,
    });
  }
  //维保首页 http://127.0.0.1:20001/repair-maintain-task/getRepairNum
  export function repairNum(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/repair-maintain-task/getRepairNum`,
      method: "post",
      data: data,
    });
  }
  //巡检首页 http://127.0.0.1:20001/treatment-inspect/getInspectNum
  export function insNum(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/treatment-inspect/getInspectNum`,
      method: "post",
      data: data,
    });
  }
  //接受维保任务 http://127.0.0.1:20001/treatment-plant/acceptMaintain?id=4
  export function acceptWb(data) {
    return request.request({
      url: `/treatment-plant/acceptMaintain?id=${data}`,
      method: "post",
      data: data,
    });
  }
  //首页维保图表 http://127.0.0.1:20001/repair-maintain-task/homePageChart?unitTime=7
  export function indexMain(data) {
    return request.request({
      url: `/repair-maintain-task/homePageChart?unitTime=${data}`,
      method: "post",
      data: data,
    });
  }
  //首页巡检图表 http://127.0.0.1:20001/treatment-inspect/homePageChart?unitTime=7
  export function indexIns(data) {
    return request.request({
      url: `/treatment-inspect/homePageChart?unitTime=${data}`,
      method: "post",
      data: data,
    });
  }
  //首页知识库图表 http://127.0.0.1:20001/knowledge-base/homePageChartKon?unitTime=7
  export function indexKnow(data) {
    return request.request({
      url: `/knowledge-base/homePageChartKon?unitTime=${data}`,
      method: "post",
      data: data,
    });
  }
  //知识库首页 http://127.0.0.1:20001/knowledge-base/trainAndLearn
  export function knowNum(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/knowledge-base/trainAndLearn`,
      method: "post",
      data: data,
    });
  }
  //考试列表 http://127.0.0.1:20001/knowledge-base/showExam
  export function knowList(data) {
    console.log(data, "传递的参数"); 
    return request.request({
      url: `/knowledge-base/showExam`,
      method: "post",
      data: data,
    });
  }
  //知识库列表详情 /knowledge-base/examDetails
  export function knoewDetail(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/examDetails?id=${data}`,
      method: "post",
      data: data,
    });
  }
  //获取待参加考试 /knowledge-base/getNotExam
  export function getNotExam(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/getNotExam`,
      method: "post",
      data: data,
    });
  }
  //发布考试/knowledge-base/post_exam
  export function postExam(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/post-exam`,
      method: "post",
      data: data,
    });
  } 
  //取消未完成的考试 http://127.0.0.1:20001/knowledge-base/delExam?id=70574425009157
  export function delExam(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/delExam?id=${data}`,
      method: "post",
      data: data,
    });
  } 
  //选择考试人员 /knowledge-base/examinable-person
  export function choosePerson(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/examinable-person`,
      method: "get",
      data: data,
    });
  } 
  //试卷列表 /item-bank/list
  export function bankList(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/test-paper/normal-list`,
      method: "post",
      data: data,
    });
  } 
  //考试编辑 http://127.0.0.1:20001/knowledge-base/updateExam
  export function updateExam(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/updateExam`,
      method: "post",
      data: data,
    });
  } 
  //我的考试记录 /knowledge-base/exam-record
  export function myRecord(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/exam-record`,
      method: "post",
      data: data,
    });
  } 
  //专家建议列表 /expert-advice/list
  export function adviceList(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/expert-advice/list`,
      method: "get",
      data: data,
    });
  } 
  //题库资料 http://127.0.0.1:20001/knowledge-base/exam-show
  export function exanList(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/exam-show`,
      method: "post",
      data: data,
    });
  } 
  //题库资料内容查询 http://127.0.0.1:20001/knowledge-base/examDetail-show?ids=1,2
  export function exanDetail(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/knowledge-base/examDetail-show?paperId=${data}`,
      method: "post",
      data: data,
    });
  } 
  //领导登录信息 http://127.0.0.1:20001/treatment-plant/LeaderLog
  export function LeaderLogList(data) {
    console.log(data, "传递的参数");
    return request.request({
      url: `/treatment-plant/LeaderLog`,
      method: "post",
      data: data,
    });
  }
  //专家功能分享经验 
  export function expertAdviceAdd(data) {
    return request.request({
      url: '/expert-advice/add',
      method: 'post',
      data,
    })
  }
  //完成考试 http://127.0.0.1:20001/knowledge-base/mark-papers
  export function donePaper(data) {
    return request.request({
      url: '/knowledge-base/mark-papers',
      method: 'post',
      data,
    })
  }
  //今日累计完成学习培训数量 http://127.0.0.1:20001/knowledge-base/finishTestNum
  export function finishTestNum(data) {
    return request.request({
      url: '/knowledge-base/finishTestNum',
      method: 'post',
      data,
    })
  }
  // 获取年度报告 /annual-report
export function getReport(data) {
  return request.request({
    url: `/annual-report?year=${data}`,
    method: "get",
    data: data,
  });
}
// 导出年度报告 /annual-report/export
export function exportReports(data) {
  return request.request({
    url: `/annual-report/export?year=${data}`,
    method: "post",
    responseType: 'arraybuffer'
  });
}
export function exportReport(data) {
  return request.request({
    url: `/annual-report/export?year=${data}`,
    method: "post",
    responseType: 'arraybuffer'
  });
}
